<?php
/**
 * Author: LCY<409028735@qq.com>
 * Time: 2021/11/19 19:24
 * Note:
 */
namespace app\admin\validate;

use app\common\validate\Base;

class Admin extends Base
{
    protected $rule = [
        'id|ID' => 'require|number',
        'username|账户' => 'require|length:5,20|unique:admin',
        'password|密码' => 'require|length:5,20',
    ];

    //登录的验证场景
    public function sceneLogin()
    {

    }

    public function sceneAdd()
    {
        return $this->only([
            'username',
            'password'
        ]);
    }

    public function sceneEdit()
    {
        return $this->only([
            'id',
            'username',
            'password'
        ])->remove('password','require');
    }

    //个人设置
    public function sceneSetting()
    {
        return $this->only([
            'id',
            'username',
            'password'
        ])->remove('password','require');
    }
}